// 礼品券列表
import { base } from '@/config'
import http from '@/utils/request'

const voucherApi = {
  // 添加礼品券
  addCoupon: params => {
    return http.postJson(`${base.coupon}/gift/add`, params)
  },
  // 删除礼品券
  deleteCoupon: couponId => {
    return http.get(`${base.coupon}/gift/delete/${couponId}`)
  },
  // 更新礼品券状态
  upadtedStatus: ({ couponId, isEnable }) => {
    return http.get(`${base.coupon}/gift/hideOrEnable/${couponId}/${isEnable}`)
  },
  // 作废
  invalidCoupon: couponId => {
    return http.get(`${base.coupon}/gift/invalidCoupon/${couponId}`)
  },
  // 获取礼品券列表
  getCouponList: params => {
    return http.get(`${base.coupon}/gift/list`, params)
  },
  // 查询礼品券详情统计
  getCouponCount: couponId => {
    return http.get(`${base.coupon}/gift/detail/countTotal/${couponId}`)
  },
  // 查询详情列表
  getDetailList: params => {
    return http.get(`${base.coupon}/gift/detail/List`, params)
  },
  // 出库
  outOfStock: params => {
    return http.postJson(`${base.coupon}/gift/detail/outLibrary`, params)
  },
  // 作废
  invalidBatch: params => {
    return http.postJson(`${base.coupon}/gift/detail/invalidBatch`, params)
  },
  // 统计门店核销数
  countStoreSale: params => {
    return http.get(`${base.coupon}/gift/count/countStoreSale`, { params })
  },
  // 渠道门店礼品券销售列表
  getStoreSaleList: params => {
    return http.get(`${base.coupon}//gift/detail/storeSaleList`, { params })
  }
}

export default voucherApi
